package cn.iocoder.an.module.mold.dal.mysql.drawingnobom;

import java.util.*;

import cn.iocoder.an.framework.common.pojo.PageResult;
import cn.iocoder.an.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.an.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.an.module.mold.dal.dataobject.drawingnobom.DrawingNoBomDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.an.module.mold.controller.admin.drawingnobom.vo.*;

/**
 * 模具图号BOM Mapper
 *
 * @author ykk
 */
@Mapper
public interface DrawingNoBomMapper extends BaseMapperX<DrawingNoBomDO> {

    default List<DrawingNoBomDO> selectList(DrawingNoBomListReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<DrawingNoBomDO>()
                .eqIfPresent(DrawingNoBomDO::getPid, reqVO.getPid())
                .eqIfPresent(DrawingNoBomDO::getDrawingNoId, reqVO.getDrawingNoId())
                .likeIfPresent(DrawingNoBomDO::getCode, reqVO.getCode())
                .likeIfPresent(DrawingNoBomDO::getName, reqVO.getName())
                .likeIfPresent(DrawingNoBomDO::getAccountName, reqVO.getAccountName())
                .likeIfPresent(DrawingNoBomDO::getAccountCode, reqVO.getAccountCode())
                .likeIfPresent(DrawingNoBomDO::getDescription, reqVO.getDescription())
                .eqIfPresent(DrawingNoBomDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(DrawingNoBomDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(DrawingNoBomDO::getId));
    }

	default DrawingNoBomDO selectByPidAndCode(Long pid, String code) {
	    return selectOne(DrawingNoBomDO::getPid, pid, DrawingNoBomDO::getCode, code);
	}


    default Long selectCountByPid(Long pid) {
        return selectCount(DrawingNoBomDO::getPid, pid);
    }

}